package lanQiao2;

import java.util.*;

public class PartNum2
{
	public static void main(String[] args)
	{
		Scanner s = new Scanner(System.in);
		
		int[] c=new int[s.nextInt()];
		for(int i=0; i<c.length; i++)
		{
			c[i]=s.nextInt();
		}
		
		for(int i=s.nextInt(); i>0; i--)
		{
			int[] c2=c.clone();
			int f=s.nextInt();
			Arrays.sort(c2, f, s.nextInt());
			System.out.println(c2[s.nextInt()+f-1]);
		}
	}
}
